using System;

namespace Fornax020.SerialComm.Exceptions
{
    /// <summary>
    /// 数据解析异常
    /// </summary>
    public class ParseException : SerialException
    {
        public string RawData { get; }
        
        public ParseException(string rawData) : base($"数据解析失败: {rawData}")
        {
            RawData = rawData;
        }
        
        public ParseException(string rawData, string message) : base($"数据解析失败: {rawData} - {message}")
        {
            RawData = rawData;
        }
        
        public ParseException(string rawData, string message, Exception innerException) : base($"数据解析失败: {rawData} - {message}", innerException)
        {
            RawData = rawData;
        }
    }
}
